import { Request, Response, NextFunction } from 'express'
import passport from 'passport'

export default function (req: Request, res: Response, next: NextFunction) {
  if (req.path.endsWith('/login') || req.path.endsWith('/token')) {
    return next()
  } else {
    passport.authenticate('jwt', { session: false })
    return next()
  }
}
